//
//  UIFactory.m
//  CloudWeibo
//
//  Created by CLOUD on 11/20/14.
//  Copyright (c) 2014 Cloud. All rights reserved.
//

#import "UIFactory.h"
#import "ThemeButton.h"
#import "ThemeImageView.h"
#import "ThemeLabel.h"

@implementation UIFactory

+ (ThemeButton *)createButton:(NSString *) imageName highlited: (NSString *) highlitedName
{
    ThemeButton *themeButton = [[ThemeButton alloc] initWithImage:imageName highlightedImage:highlitedName];
    return [themeButton autorelease];
}

+ (ThemeButton *)createButtonWithBackground:(NSString *)backImageName highlited:(NSString *)backHighlitedName
{
    ThemeButton *themeButton = [[ThemeButton alloc] initWithBackgroundImage:backImageName highlightedImage:backHighlitedName];
    return [themeButton autorelease];
}

+ (ThemeImageView *)createImageView:(NSString *) imageName
{
    ThemeImageView *themeImageView = [[ThemeImageView alloc] initWithImageName:imageName];
    return [themeImageView autorelease];
}

+ (UIButton *)createNavigationButton:(CGRect)frame title:(NSString *)title target:(id)target action:(SEL)action
{

    ThemeButton *button = [self createButtonWithBackground:@"navigationbar_button_background.png" highlited:@"navigationbar_button_delete_background.png"];
    button.frame = frame;
    [button setTitle:title forState:UIControlStateNormal];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:13.0f];
    button.leftCapWidth = 3;
    return button;
}

+ (ThemeLabel *) createLabel:(NSString *) colorName
{
    ThemeLabel *themeLabel = [[ThemeLabel alloc] initWithColor:colorName];
    return [themeLabel autorelease];
}
@end
